
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>上传图片</title>
<script type="text/javascript" src="../static/index.js"></script>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
</head>
<body>
	<table border="1" cellspacing="1" cellpadding="1" align="center">
		<tr>
			<button type="submit" th:onclick="javascript:test()"
				class="btn btn-primary">js方法测试</button>
		</tr>
		<tr>
			<td style="background: #fff" align="center" width="400px">
				<!-- 使用from表单 ，引入js实现添加的时候图片回显-->
				<form action="upload" method="post" enctype="multipart/form-data">
					选择图片:<input type="file" name="file" accept="image/*"
						th:onchange="javascript:preview(this)" />

					<div id="preview">
						<!--这个是为了将页面返回的图片展示出来的.默认隐藏-->
						<img style="width: 100px; height: 100px; display: none"
							id="imgHidden" />
					</div>
					<br> <input type="submit" value="立刻上传">
				</form> <!-- 				<button type="submit" --> <!-- 					th:onclick="javascript:submitForm()" -->
				<!-- 					class="btn btn-primary">提交</button> -->
			</td>
		</tr>
		<tr>
			<td colspan="2" style="background: #fff" align="center">底部</td>
		</tr>
	</table>
</body>
</html>